package com.wh1200.xmlless.test.dao

import com.wh1200.mybatis.xmlless.XmlLessMapper
import com.wh1200.mybatis.xmlless.annotations.NoIfWrap
import com.wh1200.mybatis.xmlless.annotations.XmllessMethod
import com.wh1200.xmlless.test.model.Menu
import org.apache.ibatis.annotations.Mapper
import org.apache.ibatis.annotations.Param

/**
 *
 * @author 吴昊
 * @date 2024/1/27 23:40
 * @version 1.0
 */
@Mapper
interface MenuDAO : XmlLessMapper<Menu> {

  /**
   * 根据用户ID查询菜单
   *
   * @param userId 用户ID
   * @return 菜单列表
   */
  @XmllessMethod(
      conditions = [
        "role.name is not null",
        "role.user.name is not null"
      ]
  )
  fun findByUserId(@NoIfWrap @Param("userId") userId: Long?): List<Menu>

  fun clean()

}
